<?php
/**
 * 账号相关
 * @author wangtao
 * @version 2011.05.20
 */

function bindingUser($openId, $username)
{
	$createDate = date('Y-m-d H:i:s');
	$createIp = $_SERVER['REMOTE_ADDR'];
	$sql = 'INSERT INTO `feed`.`user` (`uid`, `openId`, `username`, `createDate`, `createIp`, `site`)
			VALUES (NULL , \'' . $openId . '\', \'' . $username . '\', \'' . $createDate . '\', \'' . 
			$createIp . '\', \'qq\');';
	$db = mysqlDB::con();
	$db->query($sql);
}

/**
 * 判断用户是否存在了
 * @param unknown_type $uid
 */
function isValidUid($openId, $site = 'qq')
{
	$sql = 'SELECT `uid` FROM `user` WHERE `openId` = \'' . $openId . '\' AND `site` = \'' . $site . '\' LIMIT 0 , 1';
	$db = mysqlDB::con();
	$uid = $db->query2one($sql);
	return $uid;
}




